//
//  TZSocket.h
//  OurFramework
//
//  Created by 949699582 on 2019/7/19.
//  Copyright © 2019 com.cunyin.paywaiter. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <arpa/inet.h>

typedef void (^SocketBlock)(NSString * _Nullable sendMessage);
NS_ASSUME_NONNULL_BEGIN

@interface TZSocket : NSObject

//block作为属性
@property (nonatomic,strong) SocketBlock block;

@property (nonatomic,assign) int clientSocket;
// 服务器地址
@property (nonatomic,copy) NSString *url;

// 端口号
@property (nonatomic,copy) NSString *port;

// 开启socket
- (void)launchSocketWithServerIp:(char *)SERVER_IP andPort:(int)PORT;

// 关闭socket
- (void)closeSocket;

// 发送数据
- (void)sendMessage:(const char *)sendMessage;

// 接收数据
- (void)receiveMessageWithBlock:(SocketBlock) block;

@end

NS_ASSUME_NONNULL_END
